{% load i18n %}
{% extends "base.html" %}
{% block header %}
<style type='text/css' media='all'>
    div#TB_title {
        background-color: #222222;
        color: #cfcfcf;
    }
    div#TB_title a, div#TB_title a:visited {
        color: #cfcfcf;
    }

</style>

{% endblock %}

{% block h_message %}
  {%if postback%}
    <div class="info {%if not result%}error{%endif%}">{{msg}}</div>
  {%endif%}
{% endblock %}
{% block nav2 %}
<div id="dnav2"><a href="/admin/post" {%ifequal entrytype 'post'%} class="current" {%endifequal%}>{%trans "New Post" %}</a>  <a href="/admin/page" {%ifequal entrytype 'page'%} class="current" {%endifequal%}>{%trans "New Page" %}</a>
</div>
{% endblock %}

 {% block content %}
<script type="text/javascript" src="/static/xheditor/xheditor.js"></script>

<script type="text/javascript">
$(pageInit);
function pageInit()
{
    $('#content').xheditor(true,{
        tools:'full',
        internalScript:true,
        inlineScript:true,
        internalStyle:true,
        inlineStyle:true
    });
}
</script>

<form action="/admin/{{entrytype}}" method="post">

   <div class="wrap">

      <h2>{%ifequal entrytype "post"%}
      {%trans "Write Post"%}
        {%else%}
      {%trans "Write Page" %}
        {%endifequal%}
 </h2>
      <div id="poststuff">

<div id="submitlink" class="submitbox">

<div id="previewview">
</div>
{%ifequal entrytype "post"%}
<h3>{%trans "Category" %}</h3>
<div class="inside">

<p style="height:120px;overflow-y:scroll">

                    {%for cat in cats%}

                       <input type="checkbox" name="cats"  value="{{cat.slug}}" {%if cat.select %}checked="checked"{%endif%}/>{{cat.name}}<br>
                    {%endfor%}
</p>

</div>
{%endifequal%}
<p class="submit">
<input type="submit" tabindex="4" value="{% trans "Save" %}" name="save" class="button button-highlighted"/>
  <input type="checkbox" style="margin-left:10px;" tabindex="4" value="publish" name="publish" class="button button-highlighted" {%if entry.published%}checked="checked"{%endif%}/>{% trans "Published" %} <input type="checkbox" style="margin-left:10px;" tabindex="4" value="allow_comment" name="allow_comment" class="button button-highlighted" {%if entry.allow_comment%}checked="checked"{%endif%}/>{% trans "allow comment" %}
</p>

<div class="side-info">
<h5>{%trans "Related" %}</h5>

<ul>
<li><a href="/admin/entries/post">{%trans "Manage All Posts" %}</a></li>
<li><a href="/admin/entries/page">{%trans "Manage All Pages" %}</a></li>

</ul>
</div>
</div>

<div id="post-body2">
<div id="titlediv">
<h3>{%trans "Title" %}</h3>
<div id="titlewrap">
    <input type="text" autocomplete="off" id="title" value="{{entry.title|escape}}" tabindex="1" size="52" name="post_title"/>
</div>
<div class="inside">
    <div id="edit-slug-box">
    </div>
</div>
</div>

<div class="stuffbox" id="postarea">
<h3>
<div class="title">
{%ifequal entrytype "post"%}
      {%trans "Post"%}
        {%else%}
      {%trans "Page" %}
        {%endifequal%}
        </div>

<div class='clear'></div>
</h3>


<div id="editorcontainer">

  <textarea style="width: 695px;" cols="40" rows="15" id="content" name="content">{{entry.content|escape}}</textarea>
</div>
</div>

<div class="clear"></div>
<div class="stuffbox">
<h3>{% trans "Slug" %}</h3>
<div class="inside">
    <input type="text" value="{{entry.slug|escape}}" tabindex="1" size="30" name="slug"/><br/>
</div>
</div>
{%ifequal entrytype "post"%}
<div class="clear"></div>
<div class="stuffbox" id="tag">
<h3>{% trans "Tag" %}</h3>
<div class="inside">
    <input type="text" id="tags" value="{{entry.strtags|escape}}" tabindex="1" size="30" name="tags"/><br/>
</div>
</div>
{%else%}
<div class="clear"></div>
<div class="stuffbox">
<h3>{% trans "Options" %}</h3>
<div class="inside">
    <p>
     <span style="font-weight:bold;width:30px">{% trans "Page level:"%} </span><input type="text" id="entry_parent" value="{{entry.entry_parent}}" tabindex="1" size="4" name="entry_parent"/>
    <p>
      <span  style="font-weight:bold;width:30px">{% trans "Page order:"%}"</span> <input type="text" id="menu_order" value="{{entry.menu_order}}" tabindex="1" size="4" name="menu_order"/>
    </p>
</div>
</div>


{%endifequal%}

<div class="clear"></div>
<div class="stuffbox">
<h3>{% trans "Excerpt" %}</h3>
<div class="inside">
    <textarea name="excerpt" style="width:98%"/>{%if entry.excerpt%}{{entry.excerpt|escape}}{%endif%}</textarea><br/>
</div>
</div>


<input type="hidden" value="{{entry.key}}" name="key"/>
<input type="hidden" value="{{action}}" name="action"/>

</div>
</div>

   </div>
   </form>

 {% endblock  %}
